<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>5、从两个数组里生成最小数字</title>
</head>

<body>
  <script>
    var minNumber = function (nums1, nums2) {
      let t = nums1.filter(v => nums2.includes(v))
      if (t.length) return Math.min(...t)
      let a = Math.min(...nums1), b = Math.min(...nums2)
      return a > b ? b * 10 + a : a * 10 + b
    };
    console.log(minNumber([3, 5, 2, 6], [3, 1, 7]))
  </script>
</body>

</html>